<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>导航页面</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      #container {
        width: 100%;
        height: 100vh;
      }
    </style>
    <script type="text/javascript">
    window._AMapSecurityConfig = {
      securityJsCode: 'a201826b7af2dff1e82186ada5ae9ae2',
    }
  </script>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.15&key=99e0be546397e16580e323b81b68b158"></script>
</head>
<body>
<div id="container"></div>
<script>
    var map = new AMap.Map("container", {//在container里放map
      zoom: 15, //缩放级别
      center: [116.397428, 39.90923], //中心点坐标
    })
     window.onload = function () {//页面初始化之后
        if(window.shenling) {
          shenling.getLocation01("getLocation02")
        }
     }
    function getLocation02 (lon, lat) {
        //弹出一下经纬度
        //shenling.alert(lon + "---" + lat)

        // 将坐标定位到对应的经纬度上
        map.setZoomAndCenter(10, [lon, lat])
         map.plugin(["AMap.PlaceSearch"], function () {
          var MSearch = new AMap.PlaceSearch({
            pageSize: 4,
            pageIndex: 1, //请求页码，默认1
            extensions: "base", //返回信息详略，默认为base（基本信息）
          }) //构造PlaceSearch类
          AMap.event.addListener(MSearch, "complete", (result) => {

            //shenling.alert(JSON.stringify(result))

            shenling.receiveData("search_list",JSON.stringify(result?.poiList?.pois || []))
          }) //返回结果
          MSearch.searchNearBy("地点", new AMap.LngLat(lon, lat)) //关键字查询
        })
      }

    function test01() {
        shenling.alert(" Button test01 ")
    }
  </script>
</body>
</html>